/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Graph;

import java.awt.Color;

/**
 *
 * @author Andrew
 */
public class Node<T> {
    private int id;
    private Color color;
    private T element;

    public Node(int id, T element) {
        this.id = id;
        color = Color.WHITE;
        this.element = element;
    }

    public T getElement() {
        return element;
    }

    /**
     * @return the id
     */
    public int getId() {
        return id;
    }

    /**
     * @return the color
     */
    public Color getColor() {
        return color;
    }

    /**
     * @param color the color to set
     */
    public void setColor(Color color) {
        this.color = color;
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Node))
            return false;
        Node n = (Node)o;
        return ((n.id == id) && n.color.equals(color) && n.element.equals(element));
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 83 * hash + this.id;
        hash = 83 * hash + (this.color != null ? this.color.hashCode() : 0);
        hash = 83 * hash + (this.element != null ? this.element.hashCode() : 0);
        return hash;
    }
}